<?php
/**
 * Created by PhpStorm.
 * User: AivyYuan
 * Date: 2016/9/5
 * Time: 16:09
 */
namespace app\modules\mobile\controllers;

use yii\web\Controller;

class TestController extends Controller{
    protected $url = "http://127.0.0.1/yii/web/index.php?r=api/index/index";
    protected $appid = "123456";

    public function actionIndex(){
        $ch = curl_init($this->url);
        $time = time();
        $data = array("appid"=>$this->appid,'time'=>$time,'name'=>'yuanwei');

        $sign = md5(implode(',',$data));

        $data['sign'] = $sign;

        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        $output = curl_exec($ch);
        curl_close($ch);


        print_r($output);
    }
}
